package cn.zyq.ykb.service.pay;

import cn.zyq.ykb.beans.pay.PayOrder;
import cn.zyq.ykb.beans.user.User;
import cn.zyq.ykb.system.common.PageParam;
import com.github.pagehelper.PageInfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.List;

/**
 * 支付订单Service接口
 *
 * @author SystemAuth
 * @date 2023-06-01
 */
public interface PayOrderService {
    /**
     * 查询支付订单
     *
     * @param payOrderID 支付订单主键
     * @return 支付订单
     */
    PayOrder selectPayOrderByPayOrderID(Integer payOrderID);

    /**
     * 查询支付订单
     *
     * @param serviceID 支付订单业务ID
     * @return 支付订单
     */
    PayOrder detail(String serviceID);

    /**
     * 查询支付订单列表
     *
     * @param pageParam
     * @return 支付订单集合
     */
    PageInfo<PayOrder> selectPayOrderList(PageParam pageParam);

    /**
     * 查询支付订单列表
     *
     * @param param
     * @return 支付订单集合
     */
    List<PayOrder> selectPayOrderList(PayOrder param);

    /**
     * 新增支付订单
     *
     * @param param 支付订单
     * @return 结果
     */
    int insertPayOrder(PayOrder param);

    /**
     * 修改支付订单
     *
     * @param param 支付订单
     * @return 结果
     */
    int updatePayOrder(PayOrder param);

    /**
     * 批量删除支付订单
     *
     * @param payOrderIDs 需要删除的支付订单主键集合
     * @return 结果
     */
    int deletePayOrderByPayOrderIDs(Integer[] payOrderIDs);

    /**
     * 删除支付订单信息
     *
     * @param payOrderID 支付订单主键
     * @return 结果
     */
    int deletePayOrderByPayOrderID(Integer payOrderID);

    /**
     * 微信支付回调
     *
     * @param request
     * @param response
     * @return
     */
    Object wxPayNotify(HttpServletRequest request, HttpServletResponse response);

    /**
     * 支付宝支付回调
     *
     * @param request
     * @param response
     * @return
     */
    Object aliPayNotify(HttpServletRequest request, HttpServletResponse response);

    /**
     * 支付下单
     *
     * @param param
     * @param user
     * @return
     */
    PayOrder pay(PayOrder param, User user);


    /**
     * 退款
     *  @param orderCode    原始支付订单号
     * @param refundAmount 退款金额
     * @param refundReason 退款原因
     * @param user
     */
    PayOrder payRefund(String orderCode, BigDecimal refundAmount, String refundReason, String notifyUrl, User user);

    /**
     * 退款回调
     * @param request
     * @param response
     * @return
     */
    Object returnNotify(HttpServletRequest request, HttpServletResponse response);

    Object gameNotify(HttpServletRequest request, HttpServletResponse response);

    Object gameIOSNotify(HttpServletRequest request, HttpServletResponse response);
}
